package test.com.sms.selenium.singlepoint.util;

import java.util.Set;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpAssetsReportEditPageUtil extends SeleniumPageUtil {

	public  final static By SAR_LINK_GENERAL = By.id("btnTab1");
	public  final static By SAR_INPUT_COMPANY = By.id("txtAnswer_2d48898f-c8a6-4480-831d-ffa70acda848");
	public  final static By SAR_INPUT_OPERATION = By.id("txtAnswer_2dbaa13a-c346-44b0-9424-84eb086f01eb");
	public  final static By SAR_INPUT_FUNCTION = By.id("txtAnswer_526a2406-9eeb-4f78-a75c-b8bc30ef436a");
	public  final static By SAR_INPUT_APPROVER = By.id("txtAnswer_8ffd9f47-f43e-433e-bd44-a7e10ab38fdd");
	public  final static By SAR_INPUT_CONTRACT = By.id("txtAnswer_8a7ba4f2-3bf5-449b-b4d6-6339bf09438e");
	public  final static By SAR_INPUT_ADMIN = By.id("cboAnswer_fae2c044-aad4-46a3-bbce-efd3e950aa3e");
	
	public static void enterAssetsReportEditPage(WebElement element){
		Set<String> before = SeleniumUtil.getWindowHandles();
		SeleniumUtil.click(element);
		// if browser prompt out a new window, switch to it
		SeleniumUtil.switchToPromptedWindow(before, SeleniumUtil.getWindowHandles());
		waitForAssetsReportEditPageToLoad();
	}
	
	public static void waitForAssetsReportEditPageToLoad(){
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.waitOnElements(new By[]{
				SAR_LINK_GENERAL
		});
	}
}
